<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Session;
class Index extends Controller
{
    public function index()
    {
        return $this->fetch("login");//跳转到login.html
    }
    public function logincheck(){//登录判断
    	// $stuno=$_POST['stuno'];
    	// $idnum=$_POST['idnum'];
    	$stuno=input('post.stuno');
    	$idnum=input('post.idnum');
    	//判断输入的学号和身份证号是否存在

    	if(Db::table("tb_stu")->where('stuno',$stuno)->where('idnum',$idnum)->find()){//正确
            Session::set("idnum",$idnum);
            //将登录次数增加1
            Db::table("tb_stu")->where('idnum',$idnum)->setInc('loginnum'); //自增项
    		return $this->success("登录成功！","Stu/index");
    	}else{
    		return $this->error("学号或身份证号错误！");
    	}
   
    }
}